package www.lagou.app;

import org.junit.Test;
import www.lagou.dao.AccountDao;
import www.lagou.entity.Account;

import java.sql.SQLException;

public class TestAccountDao {

    AccountDao accountDao = new AccountDao();

    //  测试 通过 卡号 查询 account 信息
    @Test
    public void testFindAccountByCard() throws SQLException {

        Account account = accountDao.findAccountByCard("1122334455");

        System.out.println(account.toString());
    }

    // 测试 更新 account 的 当前余额
    @Test
    public void testUpdateAccountBalance() throws SQLException {

        Account account = accountDao.findAccountByCard("11223344553");

        account.setBalance(199);

        boolean result = accountDao.updateAccountBalance(account);

        if (result) {
            System.out.println("更新成功");
        } else {
            System.out.println("更新余额失败");
        }
    }


}
